<%@ include file="includes/top.jsp"%>

<table border="0" width="100%" cellspacing="0" cellpadding="0">
	<tr>
		<td valign="top" width="20%" align="left">
			<table align="left" bgcolor="#008800" border="0" cellspacing="2" cellpadding="2">
				<tr>
					<td bgcolor="#FFFF88">
						<s:a action="/shop/index.do">
							<b><font color="BLACK" size="2">&lt;&lt; Main Menu</font></b>
						</s:a>
					</td>
				</tr>
			</table>
		</td>
		
		<td valign="top" align="center">
			<h2 align="center">Shopping Cart</h2>
		
			<form action="/shop/updateCartQuantities.do"" method="post">
		
				<table align="center" bgcolor="#008800" border="0" cellspacing="2"
					cellpadding="5">
					<tr bgcolor="#cccccc">
						<td><b>Item ID</b></td>
						<td><b>Product ID</b></td>
						<td><b>Description</b></td>
						<td><b>In Stock?</b></td>
						<td><b>Quantity</b></td>
						<td><b>List Price</b></td>
						<td><b>Total Cost</b></td>
						<td>&nbsp;</td>
					</tr>
		
					<s:if test="${cartForm.cart.numberOfItems == 0}">
						<tr bgcolor="#FFFF88">
							<td colspan="8"><b>Your cart is empty.</b></td>
						</tr>
					</s:if>
		
					<s:iterator id="cartItem"
						value="${cartForm.cart.cartItemList.pageList}">
						<tr bgcolor="#FFFF88">
							<td><b> <s:a action="/shop/viewItem.do">
								<s:param name="itemId" value="${cartItem.item.itemId}" />
								<s:property value="${cartItem.item.itemId}" />
							</s:a></b></td>
							<td><s:property value="${cartItem.item.productId}" /></td>
							<td><s:property value="${cartItem.item.attribute1}" /> <s:property
								value="${cartItem.item.attribute2}" /> <s:property
								value="${cartItem.item.attribute3}" /> <s:property
								value="${cartItem.item.attribute4}" /> <s:property
								value="${cartItem.item.attribute5}" /> <s:property
								value="${cartItem.item.product.name}" /></td>
							<td align="center"><s:property value="${cartItem.inStock}" /></td>
							<td align="center"><input type="text" size="3"
								name="<s:property value="${cartItem.item.itemId}"/>"
								value="<s:property value="${cartItem.quantity}"/>" /></td>
							<td align="right"><fmt:formatNumber
								value="${cartItem.item.listPrice}" pattern="$#,##0.00" /></td>
							<td align="right"><fmt:formatNumber
								value="${cartItem.totalPrice}" pattern="$#,##0.00" /></td>
							<td><s:a action="/shop/removeItemFromCart.do">
								<s:param name="workingItemId" value="${cartItem.item.itemId}" />
								<img border="0" src="../images/button_remove.gif" />
							</s:a></td>
						</tr>
					</s:iterator>
					<tr bgcolor="#FFFF88">
						<td colspan="7" align="right"><b>Sub Total: <fmt:formatNumber
							value="${cartForm.cart.subTotal}" pattern="$#,##0.00" /></b><br />
						<input type="image" border="0"
							src="../images/button_update_cart.gif" name="update" /></td>
						<td>&nbsp;</td>
					</tr>
				</table>
				<center><s:if test="${!cartForm.cart.cartItemList.firstPage}">
					<s:a action="viewCart.do?page=previousCart">
						<font color="green"><B>&lt;&lt; Prev</B></font>
					</s:a>
				</s:if> <s:if test="${!cartForm.cart.cartItemList.lastPage}">
					<s:a action="viewCart.do?page=nextCart">
						<font color="green"><B>Next &gt;&gt;</B></font>
					</s:a>
				</s:if></center>
			</form>

			<s:if test="${cartForm.cart.numberOfItems > 0}">
				<br />
				<center><s:a action="/shop/checkout.do">
					<img border="0" src="../images/button_checkout.gif" />
				</s:a></center>
			</s:if>
		</td>

		<td valign="top" width="20%" align="right"><s:if
			test="${!accountForm.account.username}">
			<s:if test="${accountForm.account.listOption}">


				<s:if test="${!accountForm.myList}">
					<p>&nbsp;</p>
					<table align="right" bgcolor="#008800" border="0" cellspacing="2"
						cellpadding="3">
						<tr bgcolor="#CCCCCC">
							<td><font size="4"><b>Pet Favorites</b></font> <font
								size="2"><i><br />
							Shop for more of your <br />
							favorite pets here.</i></font></td>
						</tr>
						<tr bgcolor="#FFFF88">
							<td><s:iterator value="product"
								id="${accountForm.myList.pageList}">
								<s:a action="/shop/viewProduct.do">
									<s:param name="productId" value="${product.productId}" />
									<s:property value="${product.name}" />
								</s:a>
								<br />
								<font size="2">(<s:property value="${product.productId}" />)</font>
								<br />
							</s:iterator></td>
						</tr>
						<tr>
							<td><s:if test="${!accountForm.myList.firstPage}">
								<s:a action="viewCart.do?page=previous">
									<font color="white"><B>&lt;&lt; Prev</B></font>
								</s:a>
							</s:if> <s:if test="${!accountForm.myList.lastPage}">
								<s:a action="viewCart.do?page=next">
									<font color="white"><B>Next &gt;&gt;</B></font>
								</s:a>
							</s:if></td>
						</tr>

					</table>
				</s:if>
			</s:if>
		</s:if></td>

	</tr>
</table>

<%@ include file="includes/bottom.jsp"%>
